package com.nycreativity.elecreativity.entity.po

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableId
import com.nycreativity.elecreativity.entity.BaseEntity
import org.springframework.util.ObjectUtils
import java.math.BigDecimal

/**
 * <p>
 *  商品Sku
 * </p>
 *
 * @author sxt && ttxxi
 * @since 2021-03-22
 */
class Sku : BaseEntity() {

    /**
     * id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    var id: Long? = null

    /**
     * 商品id
     */
    var goodsId: Long? = null

    /**
     * 品牌id
     */
    var brandId: Long? = null

    /**
     * 多张图片逗号分隔
     */
    var images: String? = null

    /**
     * 商品价格
     */
    var price: BigDecimal? = null

    /**
     * 库存量
     */
    var stock: Int? = null

    /**
     * 商品具体规格
     */
    var specification: String? = null

    /**
     * 是否推荐，0：不推荐；>1：推荐，数字大小表示推荐度
     */
    @get:JvmName("getRecommended")
    var isRecommended: Int? = null


    override fun toString(): String {
        return "Sku{" +
                "id=" + id +
                ", goodsId=" + goodsId +
                ", brandId=" + brandId +
                ", images=" + images +
                ", price=" + price +
                ", stock=" + stock +
                ", specification=" + specification +
                ", isRecommended=" + isRecommended +
                ", ${super.toString()}}"
    }

    fun isEmpty(): Boolean{
        return ObjectUtils.isEmpty(id) && ObjectUtils.isEmpty(goodsId) && ObjectUtils.isEmpty(brandId)
                && ObjectUtils.isEmpty(images) && ObjectUtils.isEmpty(price) && ObjectUtils.isEmpty(stock)
                && ObjectUtils.isEmpty(specification) && ObjectUtils.isEmpty(isRecommended)
    }
}
